package com.yt.system.service.impl;

import com.yt.system.dao.AccountMapper;
import com.yt.system.dao.PrivilegeMapper;
import com.yt.system.dao.RoleMapper;
import com.yt.system.domain.Account;
import com.yt.system.domain.Privilege;
import com.yt.system.domain.Role;
import com.yt.system.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;


@Service
public class AccountServiceImpl implements AccountService {

    @Autowired
    private AccountMapper accountMapper;

    @Autowired
    private RoleMapper roleMapper;

    @Override
    public Account selectByAacount(String aacount) {
        Account account = accountMapper.selectByAacount(aacount);
        return account;
    }

    @Override
    public Role selectByAid(Integer aid) {
        System.out.println("---------aid测试---------"+aid);
        Role role = roleMapper.selectByAid(aid);
        return role;
    }


    @Override
    public List<Account> getAllAccount() {
        return accountMapper.getAllAccount();
    }

    @Override
    public int resetPassword(String apwd, Integer aid) {
        int i = accountMapper.resetPassword(apwd, aid);
        return i;
    }

    @Override
    public Account selectByPrimaryKey(Integer aid) {
        return accountMapper.selectByPrimaryKey(aid);
    }

    @Override
    public int updateAlogintime(Date alogintime, String aacount) {
        int i = accountMapper.updateAlogintime(alogintime,aacount);
        return i;
    }

    @Override


    public int updateAlogouttime(Date alogouttime, String aacount) {
        int i = accountMapper.updateAlogouttime(alogouttime,aacount);
        return i;
    }

    @Override
    public List<Account> searchLikeAccount(String str) {
        return accountMapper.searchLikeAccount(str);
    }
}
